Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ip-set

Package Overview
Dependencies
Maintainers
10
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ip-set

Efficient mutable set for IP addresses

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.8K
increased by7.67%
Maintainers
10
Weekly downloads
 
Created
Source

ip-set travis npm

IP Address Set

Efficient mutable set data structure optimized for use with IPv4 and IPv6 addresses. The primary use case is for working with potentially large IP blacklists.

Works in the browser with browserify! This module is used by WebTorrent.

install

npm install ip-set

usage

const IPSet = require('ip-set')

const ipSet = new IPSet(/* optionally pass an array of IP addresses to seed the set with */)
ipSet.add(exampleBlockedIP1)
ipSet.add(exampleBlockedIP2)
let isBlocked = ipSet.contains(exampleBlockedIP2) // isBlocked will be true

CIDR ip's are also supported

ipSet.add(`192.168.1.0/24`);
let isBlockedInList = ipSet.contains('192.168.1.0');// isBlockedInList will be true
isBlockedInList = ipSet.contains('192.168.1.255');// isBlockedInList will be true

todo

(prioritized highest to lowest)

  • Port IPv4 implementation from torrent-stream
  • Add basic tests
  • Support CIDR notation
  • Support IPv6
  • Investigate potential use of node-iptrie

credits

Original interval-tree written by galedric for torrent-stream. Ported to an isolated npm module by transitive-bullshit for webtorrent.

license

MIT. Copyright (c) Travis Fischer

Support my OSS work by following me on twitter twitter

Keywords

FAQs

Package last updated on 16 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc